import axios from 'axios'

import Nprogress from 'nprogress'
import 'nprogress/nprogress.css'

const service = axios.create({
    baseURL:'/mock',
    timeout:10000
})

service.interceptors.request.use(config=>{
    // console.log(config)
    Nprogress.start()
    return config
},err=>{
    console.log(err);
})

service.interceptors.response.use(response=>{
    Nprogress.done()
    // console.log(response);
    return response.data//返回响应体
},error=>{
    Nprogress.done()
    return new Promise(()=>{})
})

export default service
